package com.schooleducation.controller.teacher;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.schooleducation.entity.User;

@Controller
@RequestMapping("/teacher")
public class TeacherHomeController {

	@RequestMapping(method = RequestMethod.GET)
	public String getHomePage(HttpSession session, Model model) {
		User teacher = (User) session.getAttribute("teacher");
		if (teacher != null) {
			model.addAttribute("teacher", teacher);
			
			return "teacher/index";
		} else {
			return "redirect:login";
		}
	}
}
